Adaptive sampling of pixels

ABSTRACT

Adaptive sampling of pixels is disclosed. In some embodiments, a rendering of a scene is generated by sampling each pixel of the rendering with a prescribed number of samples. Subsequently, those pixels of the rendering that do not satisfy a noise threshold are iteratively sampled with an additional sample during each iteration until all pixels of the rendering satisfy the noise threshold. The noise threshold is associated with noise arising due to under sampling. Pixels comprising the completed rendering are not uniformly sampled.

CROSS REFERENCE TO OTHER APPLICATIONS

This application is a continuation of co-pending U.S. patent applicationSer. No. 16/122,737 entitled ADAPTIVE SAMPLING OF PIXELS filed Sep. 5,2018, which is a continuation of U.S. patent application Ser. No.15/081,557, now U.S. Pat. No. 10,109,100, entitled ADAPTIVE SAMPLING OFPIXELS filed Mar. 25, 2016, both of which are incorporated herein byreference for all purposes.

BACKGROUND OF THE INVENTION

In physically based rendering techniques such as path-tracing, pixelsare typically uniformly sampled. Such indiscriminate sampling of pixelsconsumes processing resources and introduces latency that may beundesirable in many cases.

BRIEF DESCRIPTION OF THE DRAWINGS

Various embodiments of the invention are disclosed in the followingdetailed description and the accompanying drawings.

FIG. 1 illustrates an embodiment of a process for rendering a scenebased on adaptive sampling.

DETAILED DESCRIPTION

The invention can be implemented in numerous ways, including as aprocess; an apparatus; a system; a composition of matter; a computerprogram product embodied on a computer readable storage medium; and/or aprocessor, such as a processor configured to execute instructions storedon and/or provided by a memory coupled to the processor. In thisspecification, these implementations, or any other form that theinvention may take, may be referred to as techniques. In general, theorder of the steps of disclosed processes may be altered within thescope of the invention. Unless stated otherwise, a component such as aprocessor or a memory described as being configured to perform a taskmay be implemented as a general component that is temporarily configuredto perform the task at a given time or a specific component that ismanufactured to perform the task. As used herein, the term ‘processor’refers to one or more devices, circuits, and/or processing coresconfigured to process data, such as computer program instructions.

A detailed description of one or more embodiments of the invention isprovided below along with accompanying figures that illustrate theprinciples of the invention. The invention is described in connectionwith such embodiments, but the invention is not limited to anyembodiment. The scope of the invention is limited only by the claims,and the invention encompasses numerous alternatives, modifications, andequivalents. Numerous specific details are set forth in the followingdescription in order to provide a thorough understanding of theinvention. These details are provided for the purpose of example, andthe invention may be practiced according to the claims without some orall of these specific details. For the purpose of clarity, technicalmaterial that is known in the technical fields related to the inventionhas not been described in detail so that the invention is notunnecessarily obscured.

In computer graphics, ray tracing is employed to render athree-dimensional scene with complex light interactions on atwo-dimensional image plane. More specifically, ray tracing facilitatescapturing a three-dimensional scene on an image sensor of a virtualcamera viewing the scene from a particular position by tracing the pathsof light rays and simulating their effects from encounters with objectscomprising the scene. In order to only trace light rays that actuallyhit or intersect the image plane, ray tracing mathematically identifiesand reproduces the path that each light ray follows in the reversedirection by tracing a path from a virtual camera position through eachpixel of the image plane to its interactions with objects of the scene,including reflection, refraction, and/or shadow effects, to eventuallyits point of origin, i.e., a light source in the scene. Based on thedetermined path of each light ray and its interaction with sceneobjects, a corresponding pixel value (i.e., pixel color) is determined.In many cases, a plurality of samples of light rays is cast from pixelsof the image plane into the scene to obtain more accurate pixel values.The path of a light ray is not deterministic but has constrainedrandomness. More samples of light rays through a pixel facilitateidentifying a converging value for that pixel in a distribution ofpossible outcomes.

Uniformly sampling with a fixed number of samples per pixel is generallyinefficient. In such cases, the number of samples required by pixelsneeding the most samples to converge is determined, and all pixels areuniformly sampled in a blanket fashion with this determined number ofsamples to ensure that a rendering with an acceptable quality orresolution is produced. The numbers of samples needed for convergencedepend on the material properties of objects comprising a scene.Typically, optically complex materials exhibit more complicatedinteractions with light and thus generally require more samples toconverge. For the same texture or pattern, diffused surfaces convergesignificantly more rapidly than shiny or specular surfaces. Thus,uniformly sampling all pixels using the same number of samplesintroduces substantial redundant sampling for pixels requiringconsiderably fewer samples to converge.

The aforementioned over sampling can be eliminated by sampling eachpixel with only as many samples that are needed to achieve convergence.However, a pixel value may not converge if the pixel represents acomplex pattern or texture that is inherently noisy. Thus, a noisy ornon-convergent pixel value may arise from a deliberately noisy patternor texture that the pixel represents and/or from insufficient sampling.In the case of the latter, the pixel needs to be further sampled withone or more additional rays. Over sampling can be prevented bydistinguishing between noise or variance arising from texture versusfrom under sampling.

Adaptive sampling of pixels based on image data during ray tracing isdisclosed. A scene that is desired to be rendered is not uniformlysampled during ray tracing. Rather, different portions of a scene underconsideration are sampled differently. That is, pixels are sampled withdifferent numbers of samples depending on the portions of an associatedscene represented by the pixels. As further described in detail herein,an optimal number of samples for each pixel is intelligently determinedbased on foreknowledge of scene textures and identifying noise arisingdue to under sampling during ray tracing. More specifically, after eachiteration (i.e., sample) of ray tracing, noise or variance in the raytraced rendering due to under sampling is identified by removing thenoise or variance due to texture, and only pixels that do not satisfy aprescribed noise threshold are further sampled in one or more subsequentiterations until all pixels satisfy the prescribed noise threshold,i.e., until all pixels converge.

The given description generally describes ray tracing. However, thedisclosed techniques may equivalently be employed with path tracing orany other ray based rendering technique that relies on tracing paths oflight.

FIG. 1 illustrates an embodiment of a process for rendering a scenebased on adaptive sampling. The rendering of the scene may comprise astill image or a frame of a video sequence. Generally, process 100 maybe performed by a virtual camera having an adaptive sensor customizedbased on the scene being rendered. In various embodiments, process 100may be performed by a processor coupled to a memory that providesinstructions to the processor or a computer program product embodied ina non-transitory computer readable storage medium.

Process 100 starts at step 102 at which a specification of a scene to berendered is received. For example, the scene to be rendered may comprisea view of a three-dimensional virtual environment from a particularvirtual camera position and/or angle. The specification of the scenereceived at step 102 may comprise information about the scene such asscene content, objects, geometry, lighting, environment, textures, etc.The specification of the scene received at step 102 may further comprisea virtual camera position from which the scene is viewed.

At step 104, an initial rendering of the scene is generated thatdetermines texture at each portion of the scene. The generated initialrendering of the scene comprises a low complexity and computational costrendering that includes texture information but excludes advancedoptical effects. In some embodiments, the initial rendering comprises arasterization or a scanline rendering. For example, the initialrendering of the scene generated at step 104 may comprise an OpenGL(Open Graphics Library) rendering. In some embodiments, the initialrendering comprises a first intersection ray cast or traced renderingwithout any bounces. The initial rendering of the scene generated atstep 104 comprises the correct brightness and textures but is devoid ofhigher order lighting effects, such as reflections, glares, shadows,etc.

At step 106, a ray traced rendering of the scene is generated by tracingan initial sample of rays. In various embodiments, the initial sample ofrays may comprise one or more samples of rays. For example, in someembodiments, step 106 comprises generating the ray traced rendering bytracing a first sample of rays for each pixel. In other embodiments, itmay be desirable to sample each pixel with at least a prescribed numberof samples of rays. In such cases, step 106 comprises generating the raytraced rendering by tracing the prescribed number of samples of rays foreach pixel.

At step 108, a measure of noise in the ray traced rendering isdetermined by subtracting the initial rendering of the scene from theray traced rendering of the scene. In various embodiments, noise may berepresented or measured using any appropriate metric such as variance ofpixel values, visible noise in the difference image, SNR(signal-to-noise ratio), etc. Subtracting the initial renderingeffectively removes texture, and, thus, any noise resulting from thetexture. The noise remaining at step 108, therefore, arises from theoptical properties of materials comprising the scene and theirinteractions with incident light. Effectively, the noise remaining atstep 108 results from under sampling, i.e., from too few samples ofrays.

At step 110, it is determined whether the noise at each portion of theray traced rendering satisfies a prescribed noise threshold. That is, itis determined whether noise or variance in pixel values across one ormore samples satisfies an acceptable threshold. More specifically, it isdetermined at step 110 whether a pixel value has converged. It isdetermined that a pixel value has converged when the pixel value doesnot substantially change (i.e., beyond the acceptable threshold) acrossa prescribed number of samples. Thus, it is determined at step 110whether or not each pixel value has converged.

If it is determined at step 110 that one or more portions of the raytraced rendering do not satisfy the prescribed noise threshold, anothersample of rays is traced for those portions in the ray traced renderingat step 112. That is, another sample of rays is traced at step 112 foreach pixel that is found not to converge at step 110. Process 100subsequently returns to step 108 and iterates steps 108-112 until allportions of the ray traced rendering satisfy the prescribed noisethreshold, i.e., until all pixels are found to converge at step 110according to a prescribed set of convergence criteria or conditions.

When it is determined at step 110 that all portions of the ray tracedrendering satisfy the prescribed noise threshold (i.e., all pixel valueshave converged), the completed ray traced rendering is output at step114, e.g., as a file or via a display. In most cases, different portionsof the completed ray traced rendering that is output at step 114 aresampled with different numbers of samples of rays. Process 100subsequently ends.

As described, a ray traced rendering is evaluated as it evolves aftereach sample. Specifically, an initial rendering that gives texture issubtracted out from the ray traced rendering after each sample to leavenoise not originating from texture complexity but from the opticalproperties of materials interacting with light in the environment of thescene. Variance in the difference image diminishes with each additionalsample. Different portions of the scene are affected differently witheach sample. Ray tracing with additional samples is continued for onlyremaining noisy portions and ceased as soon as convergence occurs. Thus,an optimal number of samples of rays is employed per pixel, essentiallyeliminating over sampling and thus significantly reducing the processingresources needed and latency introduced during rendering.

Although the foregoing embodiments have been described in some detailfor purposes of clarity of understanding, the invention is not limitedto the details provided. There are many alternative ways of implementingthe invention. The disclosed embodiments are illustrative and notrestrictive.

What is claimed is:
 1. A method, comprising: identifying pixels in arendering of a scene that have not converged due to under sampling byremoving texture to eliminate non-convergence due to texture;iteratively sampling identified pixels that have not converged due tounder sampling with one or more additional samples during each iterationuntil all pixels of the rendering converge; and outputting the completedrendering, wherein sampling of pixels is ceased as soon as convergenceoccurs to eliminate over sampling.
 2. The method of claim 1, whereinpixels of the rendering are adaptively sampled.
 3. The method of claim1, wherein pixels of the completed rendering are sampled with differentnumbers of samples.
 4. The method of claim 1, wherein pixels of thecompleted rendering are sampled with only as many samples needed tosatisfy convergence criteria.
 5. The method of claim 1, wherein pixelsof the completed rendering are sampled with optimal numbers of samples.6. The method of claim 1, wherein identifying pixels that have notconverged due to under sampling comprises determining pixels of therendering that do not satisfy a noise threshold.
 7. The method of claim6, wherein the noise threshold comprises one or more of a measure ofvariance, a measure of visible noise, and a measure of SNR(signal-to-noise ratio).
 8. The method of claim 1, wherein pixelsrepresenting shiny or specular portions of the scene are sampled morethan pixels representing diffused portions of the scene.
 9. The methodof claim 1, wherein removing texture comprises subtracting from therendering a texture rendering of the scene.
 10. The method of claim 9,wherein the texture rendering comprises a rasterization rendering, ascanline rendering, an OpenGL (Open Graphics Library) rendering, or afirst intersection path or ray traced rendering without any bounces. 11.The method of claim 9, wherein the texture rendering is devoid of higherorder optical effects.
 12. The method of claim 1, wherein removingtexture to identify pixels that have not converged due to under samplingcomprises generating a difference image during each iteration bysubtracting from the rendering a texture rendering of the scene.
 13. Themethod of claim 1, wherein over sampling of pixels is prevented bydistinguishing between noise arising from texture versus noise arisingfrom under sampling.
 14. The method of claim 1, wherein the samplescomprise samples of rays.
 15. The method of claim 1, wherein therendering comprises a physically based rendering.
 16. The method ofclaim 1, wherein the rendering comprises a path or ray traced rendering.17. The method of claim 1, wherein foreknowledge of scene textures isused to eliminate over sampling of pixels.
 18. The method of claim 1,wherein the rendering comprises a still image or a frame of a videosequence.
 19. A system, comprising: a processor configured to: identifypixels in a rendering of a scene that have not converged due to undersampling by removing texture to eliminate non-convergence due totexture; iteratively sample identified pixels that have not convergeddue to under sampling with one or more additional samples during eachiteration until all pixels of the rendering converge; and output thecompleted rendering, wherein sampling of pixels is ceased as soon asconvergence occurs to eliminate over sampling; and a memory coupled tothe processor and configured to provide the processor with instructions.20. A computer program product embodied in a non-transitory computerreadable storage medium and comprising computer instructions for:identifying pixels in a rendering of a scene that have not converged dueto under sampling by removing texture to eliminate non-convergence dueto texture; iteratively sampling identified pixels that have notconverged due to under sampling with one or more additional samplesduring each iteration until all pixels of the rendering converge; andoutputting the completed rendering, wherein sampling of pixels is ceasedas soon as convergence occurs to eliminate over sampling.